<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"sekla.cn","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="摘要与设计​    本次课程设计硬件基于 STC-IAP15F2K61S2 单片机设计，软件基于 BSP进行设计，完成了单片机对环境的数据监测存储与基于串口通信的环境数 据传输。本次设计需要充分理解 BSP 的设计思想，理解基于单片机系统调 度的事件驱动型编程，以及学习如何根据状态机进行模块化编写程序。需要完成串口通信的上下位机开发程序，以及对环境数据的存储，读写，传输。">
<meta property="og:type" content="article">
<meta property="og:title" content="单片机最终实验设计与BSP开发">
<meta property="og:url" content="http://sekla.cn/2021/09/17/%E5%8D%95%E7%89%87%E6%9C%BA%E6%9C%80%E7%BB%88%E5%AE%9E%E9%AA%8C/index.html">
<meta property="og:site_name" content="Sekla&#39;s Blog">
<meta property="og:description" content="摘要与设计​    本次课程设计硬件基于 STC-IAP15F2K61S2 单片机设计，软件基于 BSP进行设计，完成了单片机对环境的数据监测存储与基于串口通信的环境数 据传输。本次设计需要充分理解 BSP 的设计思想，理解基于单片机系统调 度的事件驱动型编程，以及学习如何根据状态机进行模块化编写程序。需要完成串口通信的上下位机开发程序，以及对环境数据的存储，读写，传输。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/09/17/EsFequZhQC1fJjK.png">
<meta property="article:published_time" content="2021-09-17T07:00:00.000Z">
<meta property="article:modified_time" content="2021-10-18T14:47:16.172Z">
<meta property="article:author" content="Sekla">
<meta property="article:tag" content="C">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/09/17/EsFequZhQC1fJjK.png">

<link rel="canonical" href="http://sekla.cn/2021/09/17/%E5%8D%95%E7%89%87%E6%9C%BA%E6%9C%80%E7%BB%88%E5%AE%9E%E9%AA%8C/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>单片机最终实验设计与BSP开发 | Sekla's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <script type="text/javascript" src="/js/my_js/clicklove.js"></script>
<!-- hexo injector head_end start -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-math@4.0.0/dist/style.css">
<!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Sekla's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Keep Learning Keep Doing</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">14</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">23</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">100</span></a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://sekla.cn/2021/09/17/%E5%8D%95%E7%89%87%E6%9C%BA%E6%9C%80%E7%BB%88%E5%AE%9E%E9%AA%8C/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="Sekla">
      <meta itemprop="description" content="Sekla">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Sekla's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          单片机最终实验设计与BSP开发
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-09-17 15:00:00" itemprop="dateCreated datePublished" datetime="2021-09-17T15:00:00+08:00">2021-09-17</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-10-18 22:47:16" itemprop="dateModified" datetime="2021-10-18T22:47:16+08:00">2021-10-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F/" itemprop="url" rel="index"><span itemprop="name">嵌入式</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F/STC51%E5%8D%95%E7%89%87%E6%9C%BA%E7%B3%BB%E5%88%97/" itemprop="url" rel="index"><span itemprop="name">STC51单片机系列</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>6.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>6 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="摘要与设计"><a href="#摘要与设计" class="headerlink" title="摘要与设计"></a>摘要与设计</h1><p>​    本次课程设计硬件基于 STC-IAP15F2K61S2 单片机设计，软件基于 BSP进行设计，完成了单片机对环境的数据监测存储与基于串口通信的环境数 据传输。本次设计需要充分理解 BSP 的设计思想，理解基于单片机系统调 度的事件驱动型编程，以及学习如何根据状态机进行模块化编写程序。需要完成串口通信的上下位机开发程序，以及对环境数据的存储，读写，传输。</p>
<a id="more"></a>

<h3 id="设计任务"><a href="#设计任务" class="headerlink" title="设计任务"></a>设计任务</h3><p>完成串口通信的下位机开发程序，以及对环境数据的存储，读写，传输，查看当前数据的类型以及M24C02 的使用情况。</p>
<p>单片机程序设计 数码管任何状态下 10ms 进行一次刷新。 首先单片机运行进入初态，数码管显示“0000 0000”，此时需要输入正确 8 位密码可进入下一状态，导航键（KN）向上拨动数码管上显示数字加 一，KN向下拨动数据减一，该数字位初始置于数码管最左端，KN向左或 者向右拨动可以切换变化数字位，当输入正确密码后进入下一状态。 下一状态此时进入数据传输状态，每 1s 采集一次温敏电阻与光敏电阻的ADC 值，并对温敏电阻 ADC 值进行转换，并将温度与光亮度数据显示在 数码管上，且每 1s 将数据作为 2 个字节数据包发送给上位机。当光照或温 度数据超过界定值则触发蜂鸣器警报。此状态下KN向左切换至存储模式， KN 向右切换至数据读取模式，KN 向上切换至上锁状态即初态，KN 向下 可检查M24C08 的使用状态。 存储模式状态下，KN向右可返回数据传输状态，KN向上可保存光照数据，KN向下可保存温度数据，同时数码管左侧显示保存的数据值，右侧显 示写入地址值，按下导航键中键可将地址重置于 0x00，K1 与K2 可分别加 或减少1次写入地址数据，当两个不同储存按下K3时可以对数据进行保存， 同时数据类型标志存入由定义的哈希函数处理过的地址中保存。三个状态 下若单片机接收到合法数据包，可以通过计算机改变地址值。 存储检查模式下可以查看数据使用状态，数据写入次数由M24C02 中一<br>位地址保存。数据读取模式下数码管初始显示 0x00 读取地址，串口接收到合法数据包，可以通过计算机改变地址值，K1 与 K2 可分别加或减少 1 次写入地址 数据，按下导航键中键可将地址重置于 0x00，按下 K3 可将相应数据读取 并显示在数码管上，左侧显示数据类型，右侧显示值，并向计算机发送数 据包。再次按下K3 返回数据读取地址切换状态。</p>
<h2 id="软件设计与实现"><a href="#软件设计与实现" class="headerlink" title="软件设计与实现"></a>软件设计与实现</h2><h3 id="依赖"><a href="#依赖" class="headerlink" title="依赖"></a>依赖</h3><p>基于BSP 设计，工程文件需要包含 STCBSP_V3.4.LIB 文件，以及配套使用头文件。</p>
<h3 id="状态图设计"><a href="#状态图设计" class="headerlink" title="状态图设计"></a>状态图设计</h3><p><img src="https://i.loli.net/2021/09/17/EsFequZhQC1fJjK.png" alt="真的最终设计状态图 .drawio"></p>
<p>按照状态机图进行事件设计与转换。 状态图中有八个状态，分别命名为密码输入状态，数据传输模式，数据存储模式，光照数据存储模式，温度存储模式，数据读取模式，内存占用检 查模式，数据读取显示模式。 进行枚举命名： 命名含义如状态图所标示。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> funcMode;<span class="comment">//状态切换变量 </span></span><br><span class="line"><span class="keyword">enum</span> funcMode&#123; </span><br><span class="line">    passwordCheck, </span><br><span class="line">    adcDataUpdata, </span><br><span class="line">    adcDataRead, </span><br><span class="line">    adcDataWrite, </span><br><span class="line">    rtDataWrite, </span><br><span class="line">    ropDataWrite, </span><br><span class="line">    realDataRead, </span><br><span class="line">    memoUseCheck</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<p><strong>全局变量定义</strong>：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> recRxd[<span class="number">3</span>];<span class="comment">//接受缓冲区大小</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> rxdHead[<span class="number">2</span>]=&#123;<span class="number">0xaa</span>,<span class="number">0x55</span>&#125;;<span class="comment">//接收包头匹配字符2字节：（0xAA，0x55）  </span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> sendRxd[<span class="number">2</span>];<span class="comment">//发送数据缓冲区</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> writeAddr=<span class="number">0x00</span>;<span class="comment">//非易失性存储地址</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> readAddr=<span class="number">0x00</span>;<span class="comment">//查询地址</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">int</span> showTemp=<span class="number">0x00</span>;<span class="comment">//数码管显示温度</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">int</span> password[<span class="number">8</span>]=&#123;<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>&#125;;<span class="comment">//passwordCheck验证</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">int</span> inputPassword[<span class="number">8</span>]=&#123;<span class="number">0</span>&#125;;</span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> rtMark=<span class="number">0xaf</span>;<span class="comment">//温度数据标记</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> ropMark=<span class="number">0xaa</span>;<span class="comment">//光照数据标记</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> writeCnt=<span class="number">0x00</span>;<span class="comment">//写次数计数</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">int</span> moveFlag=<span class="number">0</span>;<span class="comment">//确定导航按键位置变量</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">int</span> i=<span class="number">0</span>;<span class="comment">//循环标识</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> sendRealData[<span class="number">2</span>]=&#123;<span class="number">0x00</span>&#125;;<span class="comment">//realDataRead下串口发送</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//降低24C02的读取次数</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> tempReadData=<span class="number">0x00</span>; </span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> tempReadShowData=<span class="number">0x00</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> memoUseShow=<span class="number">0x00</span>;</span><br><span class="line"></span><br><span class="line">事件触发分别为每<span class="number">10</span>ms触发，导航按键与Key3触发，Key1、<span class="number">2</span>触发，串口传输触发，串口接收触发，根据以上触发事件选用并编写回调函数内容。</span><br><span class="line"></span><br><span class="line">数码管更新应该在<span class="number">10</span>ms定时触发。</span><br><span class="line"></span><br><span class="line"><span class="comment">//2,设置事件回调函数(由sys提供设置函数SetEventCallBack()) </span></span><br><span class="line"></span><br><span class="line">    SetEventCallBack(enumEventKey, mykey_callback);      </span><br><span class="line"></span><br><span class="line">    SetEventCallBack(enumEventSys10mS, my10mS_callback);    </span><br><span class="line"></span><br><span class="line">    SetEventCallBack(enumEventSys1S, my1S_callback);      </span><br><span class="line"></span><br><span class="line">    SetEventCallBack(enumEventNav, myKN_callback);       </span><br><span class="line"></span><br><span class="line"><span class="comment">//设置导航按键回调函数</span></span><br><span class="line"></span><br><span class="line">    SetEventCallBack(enumEventUart1Rxd, myUart1Rxd_callback); </span><br><span class="line"></span><br><span class="line"><span class="comment">//设置串口1接收回调函数</span></span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>根据sys.h提供的事件触发回调函数，选用以上函数。</p>
<p><strong>10ms触发函数：</strong></p>
<p>void mydealwith_10ms()</p>
<p>运用switch语句在不同状态下对数码管进行更新。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">case</span> passwordCheck:</span><br><span class="line"></span><br><span class="line">    Seg7Print(inputPassword[<span class="number">0</span>],inputPassword[<span class="number">1</span>],inputPassword[<span class="number">2</span>],inputPassword[<span class="number">3</span>],</span><br><span class="line"></span><br><span class="line">    inputPassword[<span class="number">4</span>],inputPassword[<span class="number">5</span>],inputPassword[<span class="number">6</span>],inputPassword[<span class="number">7</span>]);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">passwordCheck状态中将数码管设置为显示当前输入数字密码。</span><br><span class="line"></span><br><span class="line"><span class="keyword">case</span> adcDataUpdata:</span><br><span class="line"></span><br><span class="line">    LedPrint(<span class="number">0x00</span>);</span><br><span class="line"></span><br><span class="line">    showTemp=tempdata[ADCresult.Rt&gt;&gt;<span class="number">2</span>];<span class="comment">//查询温度表</span></span><br><span class="line"></span><br><span class="line">    Seg7Print(showTemp%<span class="number">1000</span>/<span class="number">100</span>,showTemp/<span class="number">10</span>%<span class="number">10</span>,showTemp%<span class="number">10</span>,<span class="number">10</span>,<span class="number">10</span>,</span><br><span class="line"></span><br><span class="line">    ADCresult.Rop/<span class="number">100</span>,ADCresult.Rop/<span class="number">10</span>%<span class="number">10</span>,ADCresult.Rop%<span class="number">10</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//数码管显示温度___光敏数据</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">//超过界限</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(ADCresult.Rop&lt;<span class="number">10</span>)&#123;</span><br><span class="line"></span><br><span class="line">      LedPrint(<span class="number">0x0f</span>);</span><br><span class="line"></span><br><span class="line">      SetBeep(<span class="number">1000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">    &#125;  </span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(showTemp&gt;<span class="number">40</span>)&#123;</span><br><span class="line"></span><br><span class="line">      LedPrint(<span class="number">0xff</span>);</span><br><span class="line"></span><br><span class="line">      SetBeep(<span class="number">2000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//更新发送数据包</span></span><br><span class="line"></span><br><span class="line">    sendRxd[<span class="number">0</span>]=showTemp;</span><br><span class="line"></span><br><span class="line">    sendRxd[<span class="number">1</span>]=ADCresult.Rop;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">break</span>;</span><br></pre></td></tr></table></figure>

<p>adcDataUpdata状态中查询温度表，其中ADCresult.Rt&gt;&gt;2由于根据AD采集值原理，AD值在高8位，右移两位之后，直接在温度表中查询并显示。同时检查采集值是否超过界限值，超过则蜂鸣器发声，同时更新要发送的串口数据包。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">case</span> realDataRead:</span><br><span class="line"></span><br><span class="line">    <span class="comment">//128个空间 左数码管显示类型 右数据</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">//先判断数据类型再显示</span></span><br><span class="line"></span><br><span class="line">    LedPrint(readAddr);</span><br><span class="line"></span><br><span class="line">    tempReadData=M24C02_Read(<span class="number">0xfd</span>-readAddr);</span><br><span class="line"></span><br><span class="line">    tempReadShowData=M24C02_Read(readAddr);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(tempReadData==rtMark)&#123;</span><br><span class="line"></span><br><span class="line">      Seg7Print(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>,<span class="number">10</span>,<span class="number">10</span>,tempReadShowData/<span class="number">100</span>,tempReadShowData/<span class="number">10</span>%<span class="number">10</span>,tempReadShowData%<span class="number">10</span>);</span><br><span class="line"></span><br><span class="line">      <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">else</span> <span class="keyword">if</span>(tempReadData==ropMark)&#123;</span><br><span class="line"></span><br><span class="line">      Seg7Print(<span class="number">0</span>,<span class="number">0</span>,<span class="number">2</span>,<span class="number">10</span>,<span class="number">10</span>,tempReadShowData/<span class="number">100</span>,tempReadShowData/<span class="number">10</span>%<span class="number">10</span>,tempReadShowData%<span class="number">10</span>);</span><br><span class="line"></span><br><span class="line">      <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">else</span>&#123;</span><br><span class="line"></span><br><span class="line">      Seg7Print(<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">10</span>,<span class="number">10</span>,tempReadShowData/<span class="number">100</span>,tempReadShowData/<span class="number">10</span>%<span class="number">10</span>,tempReadShowData%<span class="number">10</span>);</span><br><span class="line"></span><br><span class="line">      <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<p>避免多次连续读取24C02存储器导致读写失败，设置变量让每个状态下24C02只读取一次，就可以显示，且10ms轮询不会导致24C02读失败。</p>
<p>1s回调函数：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//1秒处理,执行串口传输</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">mydealwith_1S</span><span class="params">()</span></span>&#123;</span><br><span class="line"></span><br><span class="line">  <span class="comment">//采集AD值</span></span><br><span class="line"></span><br><span class="line">  ADCresult=GetADC();</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span>(funcMode==adcDataUpdata)</span><br><span class="line"></span><br><span class="line">    Uart1Print(&amp;sendRxd,<span class="number">2</span>);</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>每秒钟采集AD值，并将数据包通过串口发送给上位机。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//存储写处理</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">myWriteFunc</span><span class="params">()</span></span>&#123;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span>(funcMode==ropDataWrite)&#123;</span><br><span class="line"></span><br><span class="line">    M24C02_Write(writeAddr,ADCresult.Rop);</span><br><span class="line"></span><br><span class="line">    Delay15ms();<span class="comment">//写延迟</span></span><br><span class="line"></span><br><span class="line">    M24C02_Write(<span class="number">0xfd</span>-writeAddr,ropMark);</span><br><span class="line"></span><br><span class="line">    writeCnt++;</span><br><span class="line"></span><br><span class="line">    Delay15ms();</span><br><span class="line"></span><br><span class="line">    M24C02_Write(<span class="number">0xff</span>,writeCnt);</span><br><span class="line"></span><br><span class="line">    SetBeep(<span class="number">1000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">    funcMode=adcDataWrite;</span><br><span class="line"></span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">else</span> <span class="keyword">if</span>(funcMode==rtDataWrite)&#123;</span><br><span class="line"></span><br><span class="line">    M24C02_Write(writeAddr,showTemp);</span><br><span class="line"></span><br><span class="line">    Delay15ms();</span><br><span class="line"></span><br><span class="line">    M24C02_Write(<span class="number">0xfd</span>-writeAddr,rtMark);</span><br><span class="line"></span><br><span class="line">    writeCnt++;</span><br><span class="line"></span><br><span class="line">    Delay15ms();</span><br><span class="line"></span><br><span class="line">    M24C02_Write(<span class="number">0xff</span>,writeCnt);</span><br><span class="line"></span><br><span class="line">    SetBeep(<span class="number">1000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">    funcMode=adcDataWrite;</span><br><span class="line"></span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>相应状态下按下Key3按键时的触发，每次写入需要15ms延迟，以免连续写入导致写失败，数据丢失，写入完毕后蜂鸣器发出声音。同时写入相应温度或光照数据与对应标识值，根据简单线性hash计算出标识符需要写入的地址，由于24C02的总地址有256个，</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//256个空间，127个空间存储数据0x00-0x7e，127个空间存储标记0x7f-0xfd，0xff地址存储使用空间使用数量,地址0xfe=0xff为空</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//温光数据标志=254-温度数据存储地址</span></span><br><span class="line"></span><br><span class="line">根据以上设定进行存储。</span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> rtMark=<span class="number">0xaf</span>;<span class="comment">//温度数据标记</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">unsigned</span> <span class="keyword">char</span> ropMark=<span class="number">0xaa</span>;<span class="comment">//光照数据标记</span></span><br><span class="line"></span><br><span class="line"> </span><br><span class="line"></span><br><span class="line">读取发送处理，读取状态下按下Key3，同时把数据发送给上位机。</span><br><span class="line"></span><br><span class="line"><span class="comment">//读取后发送</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">realDataReadSend</span><span class="params">()</span></span>&#123;</span><br><span class="line"></span><br><span class="line">  sendRealData[<span class="number">0</span>]=M24C02_Read(<span class="number">0xfd</span>-readAddr);</span><br><span class="line"></span><br><span class="line">  sendRealData[<span class="number">1</span>]=M24C02_Read(readAddr);</span><br><span class="line"></span><br><span class="line">  Uart1Print(&amp;sendRealData,<span class="number">2</span>);</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>将数据标识与相应数据发送给上位机。</p>
<p>导航键回调函数：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">case</span> passwordCheck:</span><br><span class="line"></span><br><span class="line">      <span class="comment">//特殊位置判断</span></span><br><span class="line"></span><br><span class="line">      <span class="keyword">if</span>(GetAdcNavAct(enumAdcNavKeyLeft)==enumKeyPress)&#123;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span>(moveFlag==<span class="number">0</span>)&#123;</span><br><span class="line"></span><br><span class="line">          moveFlag=<span class="number">7</span>;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">else</span> moveFlag--;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line"></span><br><span class="line">      &#125;</span><br><span class="line"></span><br><span class="line">      <span class="keyword">else</span> <span class="keyword">if</span>(GetAdcNavAct(enumAdcNavKeyRight)==enumKeyPress)&#123;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span>(moveFlag==<span class="number">7</span>)&#123;</span><br><span class="line"></span><br><span class="line">          moveFlag=<span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">else</span> moveFlag++;</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">          </span><br><span class="line">     &#125;</span><br></pre></td></tr></table></figure>

<p>输入密码状态下对导航键改变数字位置进行移动与边界判断。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//状态1且受到合法数据包，并作为地址存入当前数据</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">myUart1Rxd_callback</span><span class="params">()</span> </span></span><br><span class="line"><span class="function"></span></span><br><span class="line"><span class="function"></span>&#123;  <span class="keyword">if</span>(funcMode==ropDataWrite||funcMode==rtDataWrite||funcMode==adcDataWrite)&#123;</span><br><span class="line"></span><br><span class="line">    writeAddr=recRxd[<span class="number">2</span>];</span><br><span class="line"></span><br><span class="line">    LedPrint(writeAddr);</span><br><span class="line"></span><br><span class="line">    SetBeep(<span class="number">1000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span>(funcMode==adcDataRead)&#123;</span><br><span class="line"></span><br><span class="line">    readAddr=recRxd[<span class="number">2</span>];</span><br><span class="line"></span><br><span class="line">    LedPrint(readAddr);</span><br><span class="line"></span><br><span class="line">    SetBeep(<span class="number">1000</span>,<span class="number">50</span>);</span><br><span class="line"></span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>串口回调函数，将接收到的合法数据包作为地址并显示。</p>
<h2 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h2><p>[1]宏晶科技-STC-B 学习板原理图-2015 </p>
<p>[2]宏晶科技-STC15F2K60S2 数据手册-2021 </p>
<p>[3]湖南大学信息科学与工程学院徐成- MySTC_B BSP_Ver3.4“STC_B 学习 板”软件支持包使用说明-2021</p>

    </div>
    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/C/" rel="tag"><i class="fa fa-tag"></i> C</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/09/06/%E6%B1%87%E7%BC%96%E4%B8%AD%E7%9A%84%E6%B5%AE%E7%82%B9/" rel="prev" title="汇编浮点数原理与实现">
      <i class="fa fa-chevron-left"></i> 汇编浮点数原理与实现
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/09/20/way-to-python/" rel="next" title="Python学习之路(1)-语法不同">
      Python学习之路(1)-语法不同 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%91%98%E8%A6%81%E4%B8%8E%E8%AE%BE%E8%AE%A1"><span class="nav-number">1.</span> <span class="nav-text">摘要与设计</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%AE%BE%E8%AE%A1%E4%BB%BB%E5%8A%A1"><span class="nav-number">1.0.1.</span> <span class="nav-text">设计任务</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BD%AF%E4%BB%B6%E8%AE%BE%E8%AE%A1%E4%B8%8E%E5%AE%9E%E7%8E%B0"><span class="nav-number">1.1.</span> <span class="nav-text">软件设计与实现</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BE%9D%E8%B5%96"><span class="nav-number">1.1.1.</span> <span class="nav-text">依赖</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%8A%B6%E6%80%81%E5%9B%BE%E8%AE%BE%E8%AE%A1"><span class="nav-number">1.1.2.</span> <span class="nav-text">状态图设计</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99"><span class="nav-number">1.2.</span> <span class="nav-text">参考资料</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Sekla"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">Sekla</p>
  <div class="site-description" itemprop="description">Sekla</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">100</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ShenTiao" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ShenTiao" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:584892986@qq.com" title="E-Mail → mailto:584892986@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

      <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=1416875904&auto=0&height=66"></iframe>
      
    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Sekla</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">288k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">4:22</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script size="300" alpha="0.6" zIndex="-1" src="/lib/canvas-ribbon/canvas-ribbon.js"></script>
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"left","width":250,"height":500},"mobile":{"show":false},"react":{"opacity":0.9},"log":false});</script></body>
</html>

<script type="text/javascript" src="/js/src/love.js"></script>
